const http = require('http')

const port = 3000
const hostname = "127.0.0.1"

//当每次请求过来时;createServer的第一个参数(回调) 会被往对应的队列中塞一次
const server = http.createServer((req, res) => {
    res.statusCode = 200
    res.setHeader('Content-Type', 'text/plain')
    res.end('hello damu\n')
})

server.listen(port, () => {
    console.log(`服务器运行在 http://${hostname}:${port}/`)
})